package com.czh.zhiwen.model.enums;

import org.apache.commons.lang3.ObjectUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum ReviewStatusEnum {

    Review("审核中", 0),
    SUCCESS("通过", 1),
    REFUSE("拒绝",2);

    private final String text;

    private final int value;

    ReviewStatusEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }

    /**
     *
     * @param value
     * @return
     */
    public static ReviewStatusEnum getReviewStatusEnum(int value){
        if(ObjectUtils.isEmpty(value)){
            return null;
        }
        for(ReviewStatusEnum reviewStatusEnum:ReviewStatusEnum.values()){
            if(reviewStatusEnum.value==value){
                return reviewStatusEnum;
            }
        }
        return null;
    }

    /**
     * 获取所有枚举值
     * @return
     */
    public static List<Integer> getValues(){
        return Arrays.stream(values()).map(item -> item.value).collect(Collectors.toList());
    }


    public int getValue() {
        return value;
    }

    public String getText() {
        return text;
    }
}
